<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/penalize/penalizeAdd.css" />
	</head>

	<body>
		<div id="Detail">
			<header class="mui-bar mui-bar-nav">
				<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left">日常监督</a>
				<h1 class="mui-title" style="width: 70%;margin-left:1.5rem ;">
				{{list.name}}
				</h1>
			</header>
			<div class="mui-content detail" id="pullrefresh">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell mui-table-view-first ">
						<span class="mui-pull-left">被查单位信息</span>
					</li>
					<li class="mui-table-view-cell  mui-table-view-list ">
						<p style="width: 100%;"><span style="vertical-align: top;" >单位名称：</span><i style="display: inline-block;width: 80%;">{{company.name}}</i></p>
						<p style="width: 100%;"><span style="vertical-align: top;">地址：</span><i style="display: inline-block;width: 80%;">{{address.city}}{{company.oaway}}{{address.address}}</i></p>
					</li>

					<!--<li class="mui-table-view-cell  mui-table-view-list ">
						<p class="wid100"><span>许可证编号:</span><i>{{company.cenumber}}</i></p>
					</li>-->
					<li class="mui-table-view-cell  mui-table-view-list ">
						<p><span>法定代表人：</span><i>{{company.legalname}}</i></p>
						<p><span>手机号：</span><i>{{company.phone}}</i></p>
					</li>
				</ul>

				<ul class="mui-table-view">
					<li class="mui-table-view-cell mui-table-view-first ">
						<span>检查信息</span>
					</li>
					<li class="mui-table-view-cell  mui-table-view-list ">
						<p style="width: 100%;"><span>检查日期：</span><i>{{list.inspectdate}} - {{list.enddate}}</i></p>
					</li>
					<li class="mui-table-view-cell  mui-table-view-list ">
						<p style="width: 100%;"><span style="vertical-align: top;">检查人员：</span><i style="display: inline-block;width: 80%;">{{list.checkuser}}</i></p>
					</li>
					<li class="mui-table-view-cell  mui-table-view-list ">
						<p><span>检查结果：</span><i>{{list.result}}</i></p>
						<p v-if="result"><span>整改状态：</span><i :class="[{'none':(list.rectify== null)},{'green':(list.rectify=='整改完成')},{'blue':(list.rectify=='整改中')},{'red':(list.rectify=='整改到期')},{'org':(list.rectify!='整改完成'&&list.rectify!='整改中'&&list.rectify!='整改到期'&&list.rectify!= null)},'status']">{{list.rectify}}</i></p>
					</li>
					<li class="mui-table-view-cell  mui-table-view-list  upbook">
						<p><span>检查记录表：</span></p>
						<div style="margin-top: -.4rem;">
							<img :src="imgsrcfirst+i.path" alt="" data-preview-src='' data-preview-group='1' v-for="i in imgsrc" />
						</div>
					</li>

				</ul>

				<ul class="mui-table-view" v-if="result">
					<li class="mui-table-view-cell mui-table-view-first ">
						<span>整改信息</span>
					</li>
					<li class="mui-table-view-cell  mui-table-view-list ">
						<p><span>整改时限：</span><i>{{list.timelimit}}天</i></p>
					</li>
					<li class="mui-table-view-cell  mui-table-view-list ">
						<p style="width: 100%;"><span style="vertical-align: top;" >整改要求：</span><i style="display: inline-block;width: 80%;">{{list.reatrequest}}</i></p>
					</li>

				</ul>
				<div class="detail-btn" id="detail-btn">
					<a href="javascript:;" @click="openEdit(id,'supervisionAdd.html')">
					</a>
				</div>
			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/lib/vue.js"></script>
		<script src="js/lib/jquery-1.11.0.js"></script>
		<script src="js/common/rutour.js"></script>
		<script src="js/common/server_commonFun.js"></script>
		<script src="js/lib/mui.zoom.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/lib/mui.previewimage.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init()
			mui.plusReady(function() {
				var currentView = plus.webview.currentWebview(); // 获取 当前webview
				currentView.show('slide-in-right', 300); // 显示当前webview (方式,时间)
				plus.nativeUI.closeWaiting(); // 关闭系统 loading 等待框
			})
			var vm = new Vue({
				el: "#Detail",
				data: {
					id: '',
					list: {},
					imgsrc: {},
					imgsrcfirst: '',
					result: true,
					flag: '',
					refresh: false,
					company: {}, //单位信息
					address: {} //地址
				},
				mounted: function() {
					this.init();
				},
				methods: {
					init: function() {
						mui.plusReady(function() {

							window.addEventListener('refresh', function(event) {
								var current = plus.webview.currentWebview();
								vm.refresh = event.detail.flag;
								console.log(vm.refresh)
								if(vm.refresh) {
									vm.flag = 'refresh';
									plus.nativeUI.showWaiting(); // 关闭系统 loading 等待框
									vm.getData();
								}
							});
							//添加newId自定义事件监听
							vm.token = plus.storage.getItem('token');
							console.log(vm.token);
							//获得事件参数
							var current = plus.webview.currentWebview();
							vm.id = current.newsid;
							//根据id向服务器请求新闻详情
							console.log(vm.id);
							vm.getData();
							mui.previewImage();
						});

					},
					getData: function() {
						mui.ajax(rutour.supervision.detail + vm.token, {
							data: {
								id: vm.id
							},
							dataType: 'json', //服务器返回json格式数据
							type: 'get', //HTTP请求类型
							success: function(res) {
								vm.list = res.data.object;
								vm.company = res.data.legaluser;
								vm.address = res.data.address;
								vm.imgsrcfirst = res.data.osspath;
								vm.imgsrc = res.data.filelist;
								console.log(res);
								console.log(vm.list.result);
								if(vm.list.result == "符合要求" || vm.list.result == "涉嫌违法") {
									vm.result = false;
								} else {
									vm.result = true;
								}
								if(vm.flag == 'refresh') {
									plus.nativeUI.closeWaiting();
									vm.flag = ''
								}
							},
							error: function(xhr, type, errorThrown) {
								console.log(type);
							}
						});
					},
					openEdit: function(id, urlName) {
						var $contentW = localStorage.getItem('$contentW'),
							$menuLeftW = localStorage.getItem('$menuLeftW');
						var nwaiting = plus.nativeUI.showWaiting();
						webviewShow = plus.webview.create(urlName, urlName, {
							left: $menuLeftW,
							width: $contentW,
						}, {
							newsid: id
						});
					}
				}
			})
		</script>

	</body>

</html>